<template>
     <div class="app">
    <div class="xw-header">
      <van-nav-bar
        :title="toUserInfo.Name"
        left-arrow @click-left="$router.back()"
      >
        <template #right>
          <!-- <div v-show='toUserInfo.CompanyId' @click='companyDetail(toUserInfo.CompanyId)' style='margin-right:15px;color:#0091ff'>公司</div> -->
          
          <van-icon name="ellipsis" size="18" @click="showOverlay = true" />
        </template>
      </van-nav-bar>
      <!-- <van-cell-group v-show="groupShow == 1">
        <van-cell
          :title="toUserInfo.enterprise_name"
          is-link
          size="large"
          center
          @click="toCompanyPage()"
          :label="toUserInfo.category_id == 2 ? '兼职' : toUserInfo.category_id == 1 ? '全职' : '小时工' "
        />
      </van-cell-group> -->
      <van-overlay
        :show="showOverlay"
        @click="showOverlay = false"
        class="over_layer"
      >
        <van-cell-group class="layer">
          <van-cell value="好友"  @click="toUser_detail(toUserInfo.UserId)"/>
          <van-cell value="公司" v-show='toUserInfo.CompanyId' @click='companyDetail(toUserInfo.CompanyId)'/>
          <van-cell value="推广" @click="$router.push('/recommend_persons?phone='+$route.params.Mobile)"/>
        </van-cell-group>
      </van-overlay>
    </div>
    
    <div class="xw-content" @touchstart="toShowMaskInfo = false" ref="xwBody">
      <div class="xw-chat-wrap">
        <ul>
          <li v-for="(messageList,index) in records" :key='index'>
            <div v-if="messageList.type == 1">
              <div class="xw-chat-time">{{ messageList.time }}</div>
              <div class="xw-chat-servicer">
                <div class="xw-servicer-avantar-wrap">
                  <img @click="head_detail(messageList)" :src="messageList.ReceiveImage" class="xw-servicer-avantar" />
                </div>
                <div v-show='messageList.MessageType == 0' class="xw-chat-msg">
                  <span @click="link(messageList.content)" v-html="replaceFace(messageList.content)"></span>
                </div>
                <div v-show='messageList.MessageType == 1' >
                  <viewer class="screen-view">
                    <img :src="messageList.content" style='width:200px;height:120px;padding:0'  />
                  </viewer>
                </div>
              </div>
            </div>
 
            <!-- 用户发送的消息模板-->
            <div v-else>
              <div class="xw-chat-time">{{ messageList.time }}</div>
              <div class="xw-chat-customer">
                <div class="xw-customer-avantar-wrap" >
                  <img @click="head_detail(messageList)" :src="messageList.SendImage" class="xw-customer-avantar" />
                </div>
                <div class="xw-chat-msg">
                  <span @click="link(messageList.content)" v-show='messageList.MessageType == 0' v-html="replaceFace(messageList.content)"></span>
                  <viewer class="screen-view">
                      <img v-show='messageList.MessageType == 1' :src="messageList.content" style='width:200px;height:120px;padding:0' />
                  </viewer>
                  <!-- <img v-show='messageList.MessageType == 1' :src="messageList.content" style='width:200px;height:120px;padding:0' /> -->
                </div>
              </div>
            </div>
          </li>
        </ul>
      </div>
    </div>
 
    <div class="xw-footer-wrap" @touchstart="toShowMaskInfo = false">
      <div class="xw-footer-content">
        <div class="xw-vmodel-wrap">
          <textarea
            class="xw-content-textarea"
            placeholder="请输入您要说的话"
            v-model="content"
            @focus="onFocusText"
          ></textarea>
        </div>
        <div class="xw-chat-tool">
          <div class="xw-chat-tool-item">
            <transition name="fade">
              <a href="javascript:void(0)" class="xw-send-btn-text" v-if="content.trim().length" @click="sendMsg"
                >发送</a
              >
            </transition>
          </div>
          <div class="xw-chat-tool-item">
            <a
              href="javascript:;"
              :class="[showEmoji ? 'xw-face' : 'xw-face-close', 'xw-chat-tool-btn']"
              @click="emojiFuc"
            ></a>
          </div>
          <div class="xw-chat-tool-item">
            <a
              :class="[showMoreOpratin ? 'xw-hide-operation-close' : 'xw-hide-operation', 'xw-chat-tool-btn']"
              @click="showMoreOpratin = !showMoreOpratin"
            ></a>
            <transition name="fade">
              <div class="xw-window-text" v-if="showMoreOpratin">
                <label for="uploadImg">
                   
                   <span>
                     <input type="file" name="image" id="uploadImg" hidden="" style="display:none;" @change="filePreview">图片
                      <!-- <input type="file" name="image"  accept="image/*" style="display:none;" @change="filePreview" id="uploadImg">图片 -->
                  </span>
                </label>
                <!-- <span @click="videoFuc">视频</span> -->
              </div>
            </transition>
          </div>
        </div>
      </div>
 
      <!--  <emojiSlider :isShow="showEmoji" :EXPS="EXPS"></emojiSlider> -->
      <!-- 表情开始 -->
      <transition name="slide-fade" style="display: none">
        <div class="xw-window-text xw-face-emoji-ul" v-if="showEmoji">
          <div class="xw-chat-ul-box">
            <mt-swipe :auto="0">
              <mt-swipe-item v-for="n in Math.ceil(EXPS.length / 15)" :key="n">
                <li v-for="(item, index) in getEmotionData(n, 15)" :key='index' class="xw-faceEmoji">
                  <img :src="item.file" :data="item.code" v-on:click="content += item.code" />
                </li>
              </mt-swipe-item>
            </mt-swipe>
          </div>
        </div>
      </transition>
    </div>
 
    <!-- 提示音 -->
    <audio style="display: none" preload="metadata" controls="controls" autoplay="autoplay" ref="hintAudio">
      <source v-if="autoPlayType == 1" src="../../assets/static/audio/msg.mp3" type="audio/mpeg" />
    </audio>
 
 
    <toast :showToast="showToast">{{ toastText }}</toast>
  </div>
</template>
 
<script>
    import $ from 'jquery'
    import signalR from './jquery.signalR-1.2.1.js'
    import evaluate from '../../components/evaluate.vue'
    import toast from '../../components/toast'
    import { Toast } from "vant";
    import {getEmojiData} from '../../api/emoij.js'
    // import emojiSlider from '.././components/emojiSlide.vue'
  export default {
        components: {
      evaluate,
      toast
    },
    data() {
      return {
        companyShow:1,
          showOverlay: false,
      value: '',
      showmsg: '',
      proxy: {},
      messageA: '',
      autoPlayType: 0,
      imgUrl: '../../assets/static/images/hang-up.png',
      comment: {},
      showEmoji: false, //是否显示表情
      showToast: false, //显示提示框
      toastText: '',
      showMoreOpratin: false, //是否显示更多操作
      toShowMaskInfo: false, //点击头部是否显示相信信息
      bellStatus: true, //头部区域铃声图标
      // myaudio: '../../assets/static/audio/msg.mp3', //铃音
      videoVal: false, //点击视频文字时候
      showNarrowPopVal: false, //点击切换成小窗口
      content: '',
      //聊天记录
      records: [
        
      ],
      toUserInfo:'',
      formUserInfo:'',
      websocketUserInfo:'',
      imgFile: {},
      EXPS: [],
      sendUserInfo: [],
      userInfo: '',
      baseIMG:'',
      meassgeList:[],
      groupShow:0,
      id:'',//职位id
      sign_state:'',
      sign_remark:''
      }
    },
    mounted() {
      console.log(this.messageList)
      if(this.$route.params.GroupId){//客服
        this.$route.params.Name = this.$route.params.GroupName
        this.companyShow = 0
      }
      if(this.$route.params.GroupId == 2){  //招聘详情进来客服
        this.groupShow = 1
        this.id = this.$route.params.id
        this.sign_state = this.$route.params.sign_state
        this.sign_remark = this.$route.params.sign_remark
      }
      this.toUserInfo = this.$route.params
      this.userInfo = JSON.parse(localStorage.getItem('userInfo')) || ''
      var $this = this
      setTimeout(function(){
        $this.getChatList()
        if($this.groupShow == 1){
          $this.sendLink($this.$route.params.detailLink)
        }
      },1000)
      
    },
    watch: {
      msg:'newMsgFU'
    },
    computed:{
      chatUserList:function() {//消息列表
          return this.$store.getters.getChatUserList;
      },
      messageList:function() {//聊天记录
          return this.$store.getters.getMessageList;
      },
      msg:function() {
        return this.$store.getters.getMsgFn;
      },
    },
created(){
  
  // this._loadEmojiData();
},
methods: {
  link(url){
      var str = url.slice(0,4)
      if(str == "http"){
        window.location.href = url
      }
  },
  // 公司客服查看用户职位详情
  toCompanyPage(){
    this.$router.push({
      path: '/jobDetail',
        query: {
          id:this.id,
          sign_state: this.sign_state,
          sign_remark: this.sign_remark
        }
      })
  },
  filePreview(e){
        let _this = this
        var files = e.target.files[0]
        if (!e || !window.FileReader) return  // 判断是否支持FileReader
        if(files.type == 'video/quicktime'){
          Toast('请选择图片')
        }else{
          let reader = new FileReader()
          reader.readAsDataURL(files) // 文件转换
          reader.onloadend = function () {
            console.log(this.result)
            _this.sendMsg('1',this.result)
          }
        }
    },
    changeData(){
      console.log(this.msg)
    },
    getUrlBase64(url, ext, callback) {
      var canvas = document.createElement("canvas"); //创建canvas DOM元素
      var ctx = canvas.getContext("2d");
      var img = new Image;
      img.crossOrigin = 'Anonymous';
      img.src = url;
      img.onload = function () {
        canvas.height = 60; //指定画板的高度,自定义
        canvas.width = 85; //指定画板的宽度，自定义
        ctx.drawImage(img, 0, 0, 60, 85); //参数可自定义
        var dataURL = canvas.toDataURL("image/" + ext);
        callback.call(this, dataURL); //回掉函数获取Base64编码
        canvas = null;
      };
    },
    // 选择图片
    chooseImg(){
   
    },
    //获取聊天记录
    getChatList(){
      let _self = this
      var msgData = JSON.parse(this.messageList)
      for(let i=0;i<msgData.length;i++){
        if(msgData[i].ReceiveUserId==this.userInfo.id){
          msgData[i].type = 1
          msgData[i].ReceiveImage =_self.toUserInfo.UserImage
        }else{
          msgData[i].SendImage = _self.userInfo.avatar
        }
      }
      msgData.forEach(item => {
        item.content = item.MessageContent
      });
      this.records = msgData.reverse()
      this.scrollToBottom()
    },
    companyDetail(id){
        //公司需求页面
      this.$router.push({
        path: `/company/${id}`,
      })
    },
    head_detail(data) {
      this.$router.push(
        { name: 'headDetail', query: { SendUserId: data.SendUserId }}
      )
    },
    toUser_detail(UserId){
      this.$router.push(
        { name: 'headDetail', params: { SendUserId: UserId }}
      )
    },
    showInfo() {
      this.toShowMaskInfo = true
    },
    //点击控制表情切换（显示和隐藏）
    emojiFuc() {
      this.showEmoji = !this.showEmoji
    },
    // videoFuc() {
    //   this.videoVal = true
    //   this.showNarrowPopVal = false
    // },
    // //提示音
    // hint(staus) {
    //   this.autoPlayType = 1
    //   if (staus != undefined) {
    //     this.bellStatus = !this.bellStatus
    //   }
    //   this.bellStatus ? this.$refs.hintAudio.play() : this.$refs.hintAudio.pause()
    // },
    showNarrowPopFuc() {
      this.showNarrowPopVal = true
      this.videoVal = false
    },
    showBigPopFuc() {
      this.showNarrowPopVal = false
      this.videoVal = true
    },
    showEvaluateFuc() {
      // this.showScore = !this.showScore;
    },
    newMsgFU(){
      var $this = this
      console.log(this.msg)
      let msgData = JSON.parse(this.msg)
      let MessageType = ''
      if(msgData.MessageType == 1){//图片
          MessageType = 1
      }else{//文字
          MessageType = 0
      }
      setTimeout(() => {
        // $this.hint()
        if(msgData.SendUserId == this.toUserInfo.UserId){
          $this.records.push({
            time: new Date().toLocaleTimeString(),
            content: msgData.MessageContent,
            type: 1,
            ReceiveImage:msgData.SendImage,
            MessageType:MessageType
          })
          $this.scrollToBottom()
        }
      }, 800)
    },
    // 发送链接
    sendLink(detailLink){
      var $this = this
      let chatUserList = JSON.parse(this.chatUserList)
      let ReceiveId = ''
      for(let i=0;i<chatUserList.length;i++){
        if($this.toUserInfo.UserId == chatUserList[i].UserId){ //获取接收者ReceiveId
          ReceiveId = chatUserList[i].Id
        }
      }
      let currentTime = //修改数据date
        new Date().getFullYear() +
        "-" +
        (new Date().getMonth() + 1) +
        "-" +
        new Date().getDate() +
        " " +
        new Date().getHours() +
        ":" +
        new Date().getMinutes() +
        ": " +
        new Date().getSeconds();
        let dataMsg = {
            MessagePage:$this.toUserInfo.MessagePage,
            SendId: "", //用户信息发送者id(边得)
            SendUserId:$this.userInfo.id, // socket发送者id
            SendName: $this.userInfo.nick_name, //发送者名字
            ReceiveId: ReceiveId, //非必须 8da6a6b1-ac70-481a-875c-9f2983976e79
            ReceiveUserId: $this.toUserInfo.UserId, //0e8bf190-7cf4-413c-80dc-19aea9809cd6 socket接收者id 1d295959-5bfe-478d-a10b-c6a7006af4ab
            ReceiveName: $this.toUserInfo.Name, //接收者名字
            MessageType: 0,
            MessageContent: detailLink
          }
          console.log(dataMsg)
          this.signaR.sendMsg(dataMsg)
          setTimeout(() => {
            // $this.hint()
            $this.records.push({
              time: currentTime,
              content: detailLink,
              SendImage:$this.userInfo.avatar,
              MessageType:0,
              type: 2,
              
            })
            console.log(formUserInfo)
            $this.scrollToBottom()
          }, 800)
    },
    sendMsg(type,dataImg) {
      var $this = this
      // let meassgeList = JSON.parse(localStorage.getItem('onLineUsers'))
      // let formUserInfo = {}
      // for(let i=0;i<meassgeList.length;i++){
      //   if($this.userInfo.id == meassgeList[i].UserId){ //自己信息
      //     formUserInfo = meassgeList[i]
      //   }
      // }
      let chatUserList = JSON.parse(this.chatUserList)
      let ReceiveId = ''
      for(let i=0;i<chatUserList.length;i++){
        if($this.toUserInfo.UserId == chatUserList[i].UserId){ //获取接收者ReceiveId
          ReceiveId = chatUserList[i].Id
        }
      }
 
      let currentTime = //修改数据date
        new Date().getFullYear() +
        "-" +
        (new Date().getMonth() + 1) +
        "-" +
        new Date().getDate() +
        " " +
        new Date().getHours() +
        ":" +
        new Date().getMinutes() +
        ": " +
        new Date().getSeconds();
      if(dataImg){   // 发送图片
            var content = $this.content.trim()
            let dataMsg = {
              SendId: "", //用户信息发送者id(边得)
              SendUserId:$this.userInfo.id, // socket发送者id
              SendName: $this.userInfo.nick_name, //发送者名字
              ReceiveId: ReceiveId, //非必须 8da6a6b1-ac70-481a-875c-9f2983976e79
              ReceiveUserId: $this.toUserInfo.UserId, //0e8bf190-7cf4-413c-80dc-19aea9809cd6 socket接收者id 1d295959-5bfe-478d-a10b-c6a7006af4ab
              ReceiveName: $this.toUserInfo.Name, //接收者名字
              MessagePage:$this.toUserInfo.MessagePage,
              MessageType: 1,
              MessageContent: dataImg
            }
            console.log(dataMsg)
            $this.signaR.sendMsg(dataMsg)
            $this.content = ''
            setTimeout(() => {
              // $this.hint()
              $this.records.push({
                time: currentTime,
                content: dataImg,
                MessageType:1,
                type: 2
              })
              $this.scrollToBottom()
            }, 800)
      }else{  //发送文字
          var content = $this.content.trim()
          let dataMsg = {
            MessagePage:$this.toUserInfo.MessagePage,
            SendId: "", //用户信息发送者id(边得)
            SendUserId:$this.userInfo.id, // socket发送者id
            SendName: $this.userInfo.nick_name, //发送者名字
            ReceiveId: ReceiveId, //非必须 8da6a6b1-ac70-481a-875c-9f2983976e79
            ReceiveUserId: $this.toUserInfo.UserId, //0e8bf190-7cf4-413c-80dc-19aea9809cd6 socket接收者id 1d295959-5bfe-478d-a10b-c6a7006af4ab
            ReceiveName: $this.toUserInfo.Name, //接收者名字
            MessageType: 0,
            MessageContent: content
          }
          console.log(dataMsg)
          this.signaR.sendMsg(dataMsg)
          $this.content = ''
          setTimeout(() => {
            // $this.hint()
            $this.records.push({
              time: currentTime,
              content: content,
              SendImage:$this.userInfo.avatar,
              MessageType:0,
              type: 2,
            })
            $this.scrollToBottom()
          }, 800)
      }
    },
  getEmotionData(pageNow, pageSize) {
    return this.EXPS.slice((pageNow - 1) * pageSize, pageSize * pageNow)
  },
  replaceFace(con) {
    if (!con) {
      return;
    }
    if (con.toString().indexOf('/:') > -1) {
      var exps = this.EXPS;
      for (var i = 0; i < exps.length; i++) {
        con = con.replace(exps[i].reg, '<img src="' + exps[i].file + '"  alt="" />');
      }
    }
    return con;
  },
 
  //滚动到底
  scrollToBottom(){
    setTimeout(()=>{
      //滚动条长度
      var currentDistance=this.$refs.xwBody.scrollHeight-this.$refs.xwBody.clientHeight;
      //当前滚动条距离顶部的距离
      var currentScroll_y=this.$refs.xwBody.scrollTop;
      if(currentDistance>0 && currentDistance>currentScroll_y){
          currentScroll_y=Math.ceil((currentDistance-currentScroll_y)/10)+currentScroll_y;
          currentScroll_y=currentScroll_y>currentDistance ? currentDistance: currentScroll_y;
          //微信和qq浏览器不支持 scrollTo？
          //this.$refs.xwBody.scrollTo(0,currentScroll_y);
          this.$refs.xwBody.scrollTop = currentScroll_y;
          this.scrollToBottom();
      }
    },13);
  },
  onFocusText(){
    this.scrollToBottom();
  },
   _loadEmojiData(){
           getEmojiData().then((res)=>{
               var json = eval('('+res+')');
               this.EXPS=json.EXPS.slice(0);
           });
   }
}
  }
</script>
<style scoped>

.over_layer {
    margin-top: 46px;
    height: 100%;
}
.layer {
    width: 40%;
    font-size: 14px;
    position: absolute;
    right: 0;
    z-index: 2;
}
.app{
    display: flex;
    flex-direction:column;
    width: 100%;
    height: 100%;
  position: absolute;
    overflow: hidden;
}
.xw-content{
    flex:1;
    position: relative;
    overflow: auto;
    transition: height .8s;
}
 
.slide-fade-enter-active {
  transition: all .3s ease;
}
.slide-fade-leave-active {
  transition: all .3s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}
.slide-fade-enter, .slide-fade-leave-to {
  transform: translateX(20px);
  opacity: 0;
}
.animated {
  -webkit-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}
 
.animated.bounceIn,
.animated.bounceOut {
  -webkit-animation-duration: .75s;
  animation-duration: .75s;
}
 
@-webkit-keyframes bounceInDown {
  from, 60%, 75%, 90%, to {
    -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
  }
 
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, -3000px, 0);
    transform: translate3d(0, -3000px, 0);
  }
 
  60% {
    opacity: 1;
    -webkit-transform: translate3d(0, 25px, 0);
    transform: translate3d(0, 25px, 0);
  }
 
  75% {
    -webkit-transform: translate3d(0, -10px, 0);
    transform: translate3d(0, -10px, 0);
  }
 
  90% {
    -webkit-transform: translate3d(0, 5px, 0);
    transform: translate3d(0, 5px, 0);
  }
 
  to {
    -webkit-transform: none;
    transform: none;
  }
}
 
.bounceInDown {
  -webkit-animation-name: bounceInDown;
  animation-name: bounceInDown;
}
 
@keyframes bounceInLeft {
  from, 60%, 75%, 90%, to {
    -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
  }
 
  0% {
    opacity: 0;
    -webkit-transform: translate3d(-3000px, 0, 0);
    transform: translate3d(-3000px, 0, 0);
  }
 
  60% {
    opacity: 1;
    -webkit-transform: translate3d(25px, 0, 0);
    transform: translate3d(25px, 0, 0);
  }
 
  75% {
    -webkit-transform: translate3d(-10px, 0, 0);
    transform: translate3d(-10px, 0, 0);
  }
 
  90% {
    -webkit-transform: translate3d(5px, 0, 0);
    transform: translate3d(5px, 0, 0);
  }
 
  to {
    -webkit-transform: none;
    transform: none;
  }
}
 
.bounceInLeft {
  -webkit-animation-name: bounceInLeft;
  animation-name: bounceInLeft;
}
 
@-webkit-keyframes bounceInRight {
  from, 60%, 75%, 90%, to {
    -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
  }
 
  from {
    opacity: 0;
    -webkit-transform: translate3d(3000px, 0, 0);
    transform: translate3d(3000px, 0, 0);
  }
 
  60% {
    opacity: 1;
    -webkit-transform: translate3d(-25px, 0, 0);
    transform: translate3d(-25px, 0, 0);
  }
 
  75% {
    -webkit-transform: translate3d(10px, 0, 0);
    transform: translate3d(10px, 0, 0);
  }
 
  90% {
    -webkit-transform: translate3d(-5px, 0, 0);
    transform: translate3d(-5px, 0, 0);
  }
 
  to {
    -webkit-transform: none;
    transform: none;
  }
}
 
.bounceInRight {
  -webkit-animation-name: bounceInRight;
  animation-name: bounceInRight;
}
 
@keyframes bounceInUp {
  from, 60%, 75%, 90%, to {
    -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
  }
 
  from {
    opacity: 0;
    -webkit-transform: translate3d(0, 3000px, 0);
    transform: translate3d(0, 3000px, 0);
  }
 
  60% {
    opacity: 1;
    -webkit-transform: translate3d(0, -20px, 0);
    transform: translate3d(0, -20px, 0);
  }
 
  75% {
    -webkit-transform: translate3d(0, 10px, 0);
    transform: translate3d(0, 10px, 0);
  }
 
  90% {
    -webkit-transform: translate3d(0, -5px, 0);
    transform: translate3d(0, -5px, 0);
  }
 
  to {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
}
 
.bounceInUp {
  -webkit-animation-name: bounceInUp;
  animation-name: bounceInUp;
}
 
/* 外部css */
 
html,body,a,button,input,textarea,img,ul,li,p,dl,dd,h1,h2,h3,h4,h5,h6{
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
a,button,input,textarea,img{
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  outline: none;
}
body {
  height: 100%;
  width: 100vw;
  overflow: hidden;
  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, 微软雅黑, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.43;
  color: #333;
  word-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  transition:.5s;
}
 
a {
  text-decoration: none;
  color: #4078c0;
}
 
img {
  border-style: none;
}
 
ul{
  list-style: none;
}
 
::-webkit-scrollbar-track {
  border-radius: 0;
  padding: 0;
  background-color: transparent;
}
 
::-webkit-scrollbar-thumb {
  border-radius: 10px;
  padding: 0;
  background-color: rgba(0, 0, 0, .2);
}
 
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
  background-color: transparent;
}
.fade-enter-active, .fade-leave-active {
  transition: opacity .3s;
}
.fade-enter, .fade-leave-to{
  opacity: 0;
}
 
.xw-ring-wrap{
  position: absolute;
  right: 5px;
  top: 3px;
  padding: 0 2px;
  z-index: 4;
}
 
.xw-ring-icon {
  /* background: url(/static/images/soundOn.svg) no-repeat 50%; */
}
 
 .xw-ring-icon-toggle{
   /* background: url(/static/images/soundClose.svg) no-repeat 50%; */
}
 
.xw-ring-icon {
  float: right;
  padding: 5px;
  margin-right: 3px;
  height: 30px;
  width: 30px;
  opacity: .6;
  cursor: pointer;
  text-indent: -9999px;
  overflow: visible;
}
 
.xw-body-wrap-scroll,.xw-body-wrap-scroll-main{
   position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  overflow: hidden;
  -webkit-overflow-scrolling: auto;
}
 
 
.xw-header {
  z-index: 2;
  max-height: 360px;
  background: #ed4858;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
 
.xw-header-content {
  position: relative;
  overflow: hidden;
  padding: 0px 16px;
  min-height: 50px;
}
 
 
.xw-chat-servicer:after,
.xw-chat-servicer:before,
.xw-chat-customer:after,
.xw-chat-customer:before,
.xw-chat-wrap:after,
.xw-chat-wrap:before,
.xw-chat-tool:after,
.xw-chat-tool:before,
.xw-chat-ul-box:after,
.xw-chat-ul-box:before {
  display: table;
  content: "";
}
 
.xw-header-avatar {
  float: left;
  height: 40px;
  width: 40px;
  border-radius: 100%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
  margin-right: 8px;
  margin-top: 5px;
}
 
.xw-header-title-wrap {
  padding: 3px 0;
  float: left;
  width: 200px;
}
 
.xw-header-title {
  font-size: 14px;
  color: #fff;
  margin-top: 8px;
}
 
 
.xw-chat-wrap {
  overflow: auto;
  padding-left: 16px;
  padding-bottom: 20px;
}
 
.xw-chat-wrap .xw-chat-time,
.xw-chat-wrap time {
  line-height: 1;
  text-align: center;
  display: block;
  margin-bottom: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: #999;
  text-shadow: 1px 1px 1px hsla(0, 0%, 100%, .6);
}
 
.xw-chat-servicer,
.xw-chat-customer {
  position: relative;
  margin-bottom: 16px;
  padding: 0 10px 0 45px;
}
 
.xw-servicer-avantar-wrap {
  position: absolute;
  bottom: 0;
  line-height: 0;
}
.xw-send-btn-text{
  padding: 4px 8px;
  background-color:#ed4858;
  color: #fff;
  border-radius: 5px;
}
.xw-customer-avantar-wrap {
  position: absolute;
  bottom: 0;
  right: 8px;
  line-height: 0;
}
 
.xw-chat-servicer .xw-servicer-avantar-wrap,.xw-customer-avantar-wrap{
  left: 0;
}
 
.xw-servicer-avantar {
  border-radius: 100%;
}
 
.xw-servicer-avantar-wrap img,.xw-customer-avantar-wrap img {
  height: 34px;
  width: 34px;
}
 
.xw-chat-msg {
  -webkit-font-smoothing: antialiased;
  hyphens: auto;
  word-wrap: break-word;
  word-break: normal;
  position: relative;
  clear: both;
  padding: 8px 16px;
  border: 1px solid transparent;
  max-width: 100%;
  min-width: 50px;
  min-height: 22px;
  line-height: 1.6em;
  max-width: 70%;
}
 
.xw-chat-servicer .xw-chat-msg {
  background: #fff;
  border-color: #efefef;
  float: left;
}
 
.xw-chat-msg :last-child {
  margin-bottom: 0;
}
 
.xw-chat-msg span{
  white-space: pre-line;
}
.xw-chat-servicer,
.xw-chat-customer {
  position: relative;
  margin-bottom: 16px;
  padding: 0 10px 0 45px;
}
 
.xw-chat-customer {
  text-align: right;
}
 
.xw-chat-customer .xw-chat-msg {
  float: right;
  text-align: left;
  background: #0091ff;
  border-color: #0091ff;
  color: #fff;
  margin-right: 45px;
}
.xw-customer-avantar{
  border-radius: 50%;
}
.xw-chat-msg :last-child {
  margin-bottom: 0;
}
 
.xw-chat-wrap .xw-system-info-time,
.xw-chat-wrap time {
  line-height: 1;
  text-align: center;
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: #999;
  text-shadow: 1px 1px 1px hsla(0, 0%, 100%, .6);
}
 
.xw-system-info{
  margin-bottom: 8px;
}
 
.xw-chat-wrap>:last-child {
  margin-bottom: 16px;
}
 
.xw-system-info {
  text-align: center;
  font-size: 12px;
}
 
.xw-system-info span {
  display: inline-block;
  background: rgba(0, 0, 0, .08);
  padding: 4px 8px;
  line-height: 1;
  color: #7c7c7c;
  border-radius: 2px;
  text-shadow: 1px 1px 1px hsla(0, 0%, 100%, .6);
}
 
.xw-footer-wrap {
  justify-content:flex-end;
  width: 100%;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, .05);
  background: #fff;
  z-index: 2;
}
 
.xw-footer-content {
  position: relative;
  height: 52px;
  display: flex;
 box-shadow: rgba(0, 0, 0, 0.05) 0px -1px 4px;
}
.xw-vmodel-wrap{
  flex:1;
}
.xw-content-textarea{
  box-sizing: border-box;
  z-index: 1;
  overflow-y: auto;
  font-size: 14px;
  line-height: 14px;
  border: none;
  resize: none;
  padding: 16px 85px 16px 14px;
  font-family: inherit;
  white-space: pre;
  white-space: pre-wrap;
  word-wrap: break-word;
}
 
.xw-chat-tool {
  position: absolute;
  right: 0px;
  bottom: 0;
  z-index: 2;
}
 
.xw-chat-tool-item {
  height: 52px;
  line-height: 52px;
  position: relative;
  float: left;
  background: #fff;
}
 
 
.xw-chat-tool-btn {
  display: block;
}
 
.xw-chat-tool-btn {
  margin-top: 7px;
  height: 38px;
  width: 38px;
  border-radius: 100%;
  text-indent: -9999px;
  opacity: .5;
  overflow: hidden;
  transform: translateZ(0);
  margin-left: 10px;
}
 
.xw-chat-tool-btn.xw-face {
   background: url(/static/images/smileOn.svg) no-repeat 50%;
}
.xw-chat-tool-btn.xw-face-close {
   background: url(/static/images/smileClose.svg) no-repeat 50%;
}
 
.xw-chat-tool-item .xw-window-text {
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-bottom: -3px;
  -webkit-transform: translateX(-60%);
  transform: translateX(-60%);
  white-space: nowrap;
  box-shadow: 0 3px 18px 2px rgba(0, 0, 0, .1), 0 0 1px rgba(0, 0, 0, .05);
  font-size: 12px;
  background: #fff;
  line-height: 1em;
}
 
.xw-chat-tool-item .xw-window-text.xw-face-emoji-ul {
  right: -23px;
  left: auto;
  -webkit-transform: none;
  transform: none;
}
 
.xw-chat-tool-item .xw-window-text h4 {
  font-size: 12px;
  margin: 0;
  font-weight: 400;
  padding: 12px 8px;
  padding-bottom: 0;
}
 
 
.xw-chat-ul-box{
  list-style: none;
  margin: 0;
  padding: 0;
}
 
.xw-chat-ul-box {
  position: relative;
  z-index: 1;
  background: #fff;
  padding: 8px;
  height: 130px;
  overflow: hidden;
  width: 340px;
  margin: 0px auto;
}
 
.xw-chat-tool-item .xw-window-text .xw-chat-ul-box {
  padding: 8px;
}
.swiper-slide{
  float: left;
}
 
.xw-chat-ul-box a {
  display: block;
  height: 40px;
  width: 40px;
}
.swiper-pagination{
  display: flex;
  width: 100%;
  justify-content:center;
}
.swiper-pagination-bullet{
  width: 8px;
  height: 8px;
  display: inline-block;
  background: #ccc;
  border-radius: 10px;
  margin-left:5px;
  margin-right: 5px;
}
.swiper-pagination-bullet-active{
  background: #007aff;
}
 
.xw-chat-tool-item {
  height: 52px;
  position: relative;
  float: left;
}
 
.xw-hide-operation{
  background: url(../../static/images/addOn.svg) no-repeat 50%;
  width: 38px;
  height: 38px;
  margin-right:10px;
  transform:scale(.7);
}
 
.xw-hide-operation-close{
  background: url(../../static/images/addClose.svg) no-repeat 50%;
  width: 38px;
  height: 38px;
  margin-right:10px;
  transform:scale(.7);
}
 
.xw-chat-tool-item .xw-window-text span {
  display: block;
  padding: 10px 12px;
  background: #fff;
  position: relative;
  z-index: 1;
  font-size: 17px;
  line-height: 16px;
}
 
 
.xw-chat-servicer:after,
.xw-chat-customer:after,
.xw-chat-wrap:after,
.xw-chat-tool:after,
.xw-chat-ul-box:after{
  clear: both;
}
 
.xw-chat-msg:last-child:before {
  bottom: -1px;
}
 
.xw-chat-msg:last-child:after,
.xw-chat-msg:last-child:before {
  content: "";
  position: absolute;
  height: 0;
  width: 0;
  display: block;
}
 
.xw-chat-customer .xw-chat-msg:last-child:before {
  display: inline-block;
  height: 0;
  width: 0;
  border: 10px solid transparent;
  border-bottom: 10px solid #0091ff;
  right: -10px;
  border-left-width: 9px;
}
 
.xw-chat-servicer .xw-chat-msg:last-child:before {
  display: inline-block;
  height: 0;
  width: 0;
  border: 10px solid transparent;
  border-bottom: 10px solid #efefef;
  left: -10px;
  border-left-width: 9px;
}
 
.xw-chat-servicer .xw-chat-msg:last-child:after {
  display: inline-block;
  height: 0;
  width: 0;
  border: 10px solid transparent;
  border-bottom: 10px solid #fff;
  left: -8px;
  border-left-width: 9px;
  bottom: 0px;
}
 
.xw-show-info-box{
  height: 200px;
  margin-top: -50px;
  z-index: 1000;
  background: #ed4858;
  color:#fff;
}
 
.xw-logo{
  text-align: center;
}
 
.xw-logo img{
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin-top: 20px;
}
 
.xw-header-info p{
  height: 110px;
  padding:0 16px;
  line-height: 1.6rem;
  word-wrap: break-word;
  text-align: left;
  overflow: auto;
}
 
 
.xw-faceEmoji{
  margin-bottom: 7px;
  width:20%;
  float: left;
}
 
.xw-faceEmoji-main{
  text-align: center;
}
 
.xw-samll-pop-wrap{
  position: absolute;
  height: 160px;
  width: 30%;
  top: 0;
  right: 0;
 background-size: 100% 100%;
 background: url(../../static/images/s.jpg) no-repeat;
  z-index: 1000;
}
.xw-pop-server{
 background: url(../../static/images/s.jpg) no-repeat;
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
}
.xw-pop-customer{
  position:absolute;
  bottom: 20px;
  width: 80%;
  height: 200px;
  background: url(/static/images/c.jpg) no-repeat;
  z-index: 101;
  left:50%;
  margin-left: -40%;
  text-align: center;
}
.xw-narrow-pop{
  width: 40px;
  height: 40px;
  position: absolute;
  right: 5px;
  top: 5px;
  display: inline-block;
  background: red;
  color: #fff;
  text-align: center;
}
.xw-big-pop{
  display:block;
  background: red;
  color: #fff;
  line-height: 40px;
  text-align: center;
}
.xw-hang-up{
  background: red;
  width: 100px;
  height: 34px;
  display: inline-block;
  border-radius: 20%;
  position: absolute;
  bottom: 10px;
  transform:translateX(-50%);
}
.xw-hang-up-icon{
  position: relative;
  z-index: 1290;
  width: 40px;
  height: 34px;
 
}
.xw-chat-msg span img{
  vertical-align: middle;
}
.mint-swipe-items-wrap > div{
  text-align: center;
}
.xw-scroll-ul{
  min-height: 340px;
}
.mint-swipe-indicator.is-active {
  background: #ed4858;
  opacity: 1;
}
</style>